﻿Public Class OptionsForm
    Private Sub LinkLabel_LinkClicked(ByVal sender As System.Object, ByVal e As System.Windows.Forms.LinkLabelLinkClickedEventArgs) Handles LinkLabel1.LinkClicked
        Dim fdlg As OpenFileDialog = New OpenFileDialog
        fdlg.Title = "SolidWorksPart Template"
        fdlg.InitialDirectory = "S:\VanAire Templates"
        fdlg.Filter = "Part Templates (*.PRTDOT)|*.prtdot"
        fdlg.FilterIndex = 1
        fdlg.RestoreDirectory = True
        If fdlg.ShowDialog() = DialogResult.OK Then
            TextBox1.Text = fdlg.FileName
        End If

    End Sub

    Private Sub LinkLabe2_LinkClicked(ByVal sender As System.Object, ByVal e As System.Windows.Forms.LinkLabelLinkClickedEventArgs) Handles LinkLabel2.LinkClicked
        Dim fdlg As OpenFileDialog = New OpenFileDialog
        fdlg.Title = "SolidWorksPart Template"
        fdlg.InitialDirectory = "S:\VanAire Templates"
        fdlg.Filter = "Assembly Templates (*.ASMDOT)|*.asmdot"
        fdlg.FilterIndex = 1
        fdlg.RestoreDirectory = True
        If fdlg.ShowDialog() = DialogResult.OK Then
            TextBox2.Text = fdlg.FileName
        End If
    End Sub

    Private Sub btnApply_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnApply.Click
        My.Settings.PartTemplateLocation = TextBox1.Text
        My.Settings.AssemblyTemplateLocation = TextBox2.Text
        My.Settings.Save()
    End Sub

    Private Sub btnOK_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnOK.Click
        My.Settings.PartTemplateLocation = TextBox1.Text
        My.Settings.AssemblyTemplateLocation = TextBox2.Text
        My.Settings.Save()
        Me.Close()
    End Sub

    Private Sub btnCancel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCancel.Click
        Me.Close()
    End Sub

    Private Sub OptionsForm_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        TextBox1.Text = My.Settings.PartTemplateLocation
        TextBox2.Text = My.Settings.AssemblyTemplateLocation
    End Sub

End Class
